<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
header("Content-Type: text/html; charset=UTF-8");
class Categorylist extends CI_Controller {

	/**
	 * Index Page for this controller.
	 *
	 * Maps to the following URL
	 * 		http://example.com/index.php/welcome
	 *	- or -  
	 * 		http://example.com/index.php/welcome/index
	 *	- or -
	 * Since this controller is set as the default controller in 
	 * config/routes.php, it's displayed at http://example.com/
	 *
	 * So any other public methods not prefixed with an underscore will
	 * map to /index.php/welcome/<method_name>
	 * @see http://codeigniter.com/user_guide/general/urls.html
	 */

	public function index(){
		$this->load->helper('url');
		$this->load->view('blogview');
	}
	
	
	public function clist($cate1, $cate2,$offset)
	{	$this->load->helper('url');
		//anchor(site_url("/categorylist/index/861/875"),'asdf');
		echo site_url("categorylist/index/861/875");
		$url = 'http://api.danawa.com/api/main/category/product/list?charset=utf8&key=fd25bbfcb76e369ecabc6e7690028f4c&cate1='.$cate1.'&cate2='.$cate2.'&orderBy=saveCountDESC&limit=10&offset='.$offset;

		$this->load->model('categorylistmodel');
		$temp1=$this->categorylistmodel->categorylist($url);
	
		$temp['result']=$temp1;
		$temp['offset']=$offset;
		$this->load->view('categorylistview',$temp);
		
	}
	
	public  function product($code,$offset){
		//2074034
		$this->load->helper('url');
		$url = 'http://api.danawa.com/api/main/product/info?key=fd25bbfcb76e369ecabc6e7690028f4c&mediatype=xml&charset=euckr&prodCode='.$code;
		
		$this->load->model('categorylistmodel');
		$temp1=$this->categorylistmodel->category($url);
		
		$temp['result']=$temp1;
		$temp['offset']=$offset;
		$this->load->view('productView',$temp);
		//var_dump($temp1);
	}
	
}

